<!DOCTYPE html>
{% load staticfiles %}
<html lang='en'>
<head>
{% block extracss %}{% endblock %}
{% block extrajs %}
{% endblock %}
</head>
<body>
<div id='contentContainer'>

<div id='pagesTitle' class='row'><h3 class='span4 offset5'>Showing {{itemName}}</h3></div>

<div id='newShowTableContainer'>
<div id='datatable'>
    {% if datas %}
	<div id='pageshow' class='pull-right text-info'>showing {{s}} to {{e}}</div>
	<table class='table table-striped table-hover table-bordered ' id='newShowTable'>
		<thead>
			<tr>
			<th></th>
			{% for column in columnNames %}
				<th>{{column}}</th>
			{% endfor %}
			</tr>
		</thead>
		<tbody>
			{% for dataId, dataItem in datas %}
			<tr>
			<td><input id='newShowTable{{dataId}}' type='radio' value='{{dataId}}' name='rowchoose' /></td>
			{% for data in dataItem %}
				<td>{{data}}</td>
			{% endfor %}
			</tr>
			{% endfor %}
		</tbody>
	</table>
    {% else %}
	No datas
    {% endif %}
    <div id='buttons' class='row'>
	<div id='addbutton' onclick='add()' data-target="#poptable" data-toggle="modal" style='margin-left:20px;' class='btn btn-inverse pull-left {%ifequal itemName 'results' %} hide {%endifequal%}'><i class="icon-plus icon-white"></i> add</div>
	<div id='delete' style='margin-left:20px;' class='btn btn-inverse pull-left' onclick='deleteItem()'><i class="icon-trash icon-white"></i> delete</div>
	<div id='modify' style='margin-left:20px;' class='btn btn-inverse pull-left {%ifequal itemName 'results' %} hide {%endifequal%}' onclick='modify()'><i class="icon-pencil icon-white"></i> modify</div>
	{% ifequal itemName 'tests' %}
	<div id='runTest' style='margin-left:20px;' class='btn btn-inverse pull-left' onclick='run()'><i class="icon-play icon-white"></i> run</div>
	{% endifequal %}
	{% ifequal itemName 'results' %}
	<div id='runTest' style='margin-left:20px;' class='btn btn-inverse pull-left' onclick='showChart()'><i class="icon-eye-open icon-white"></i> show</div>
	{% endifequal %}
	<div id='nextbutton' style='margin-right:25px;' class='btn btn-inverse pull-right' onclick='next()'>next <i class="icon-forward icon-white"></i></div>
	<div id='prebutton' style='margin-right:20px;' class='btn btn-inverse pull-right {%ifequal s 1 %} disabled {%endifequal%}' onclick='previous()'><i class="icon-backward icon-white"></i> previous</div>
    </div>
    <div class='lastline'></div>
</div>
</div>

<div id='poptable' style='width:55%; height:75%;border-radius:0px;' class='modal hide fade' tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class='modal-header' style='height: 6%; background-color:#1b1b1b; color:white;'>
	<button type='button' class='close' data-dismiss='modal' aria-hidden='true' style='color:white;'>x</button>
        <h3 id='myModalLabel' >Add {{ itemName }}</h3>
    </div>
    <div style='overflow: auto;max-height:82%;height: 82%;'>
    {% for column, lineType, inputType, buttonType in columnsInfo %}
        <div id='{{column}}' class="row {{lineType}}" {% ifequal lineType 'headline' %}style='margin:10px 0 15px 0; border-bottom: 1px solid #444444;'{% endifequal %}>
	    {% ifequal lineType 'normal' %}
	    	<div class='span3 offset1 firstcolumn'>{{ column }} :</div>
	    {% endifequal %}
	    {% ifequal lineType 'headline' %}
		<div class='span3 offset1 firstheadline'><strong>{{ column }}</strong></div>
	    {% endifequal %}

	    {% ifequal inputType 'disable' %}
		<input class='span4 offset1' style='float:left' type='text' name="{{column }}" disabled="disabled" />
	    {% endifequal %}
            {% ifequal inputType 'disableupload' %}
                <input class='span4 offset1' style='float:left;' type='text' name="{{column }}" value="source" disabled="disabled"/>
            {% endifequal %}
            {% ifequal inputType 'normal' %}
                <input class='span4 offset1' type='text' name="{{column }}"/>
            {% endifequal %}
            {% ifequal inputType 'textarea' %}
                <textarea class='span4 offset1' rows="3" cols="26"></textarea>
            {% endifequal %}

	    {% ifequal buttonType 'choose' %}
                <input type='hidden' name='{{column}}ForeignId' />
                <div class='btn btn-link span2 offset1 foreignbutton' onclick='chooseForeign(this)'>
                <input type='hidden' value='{{ column}}'/>
                choose
                </div>
            {% endifequal %}
            {% ifequal buttonType 'upload' %}
                <div id='uploadbutton' class='btn btn-link span2 offset1 foreignbutton' onclick='upload(this)'>upload</div>
            {% endifequal %}
            {% ifequal buttonType 'headchoose' %}
                <div class='btn btn-link span2 offset5 headchoose' onclick='selectForeign(this)'>select</div>
            {% endifequal %}
        </div>
    {% endfor %}
    </div>
    <div class='modal-footer' style='height:6%;'>
    	<button type='button' onclick='addObjects()' id='submitbutton' class='btn btn-inverse pull-left'><i class="icon-screenshot icon-white"></i> submit</button>
    	<div id="choosedalert" class="hide">upload files success</div>
    </div>
</div>
<div id='selectpop' style='width:55%; height:75%;' class='hide modal fade' tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
</div>
<div id='uploadpop' style='width:55%; height:75%;' class='modal hide fade'>
{% include 'showControler/pages/new_upload_pop_table.html' %}
</div>
<div id='container' style='width:900px;height:570px;' class='hide modal fade'></div>

<form id='postform' enctype="multipart/form-data" method='post'>{% csrf_token %}</form>
<form id='getform' method='get'></form>
<input id='testsps' type='hidden' value="{{tps}}"/>
<input id='resultps' type='hidden' value="{{rps}}"/>
<input id='machineps' type='hidden' value="{{mps}}"/>
<input id='projectps' type='hidden' value="{{pps}}"/>
<input id='sourcecodeps' type='hidden' value="{{sps}}"/>
</div>
</body>
</html>
